package com.yanqu.road.entity.activity.soulbone;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.soulbone.config.SoulBoneLotteryInfo;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class SoulBoneConfig {

    private ActivityInfo activityInfo;

    public SoulBoneConfig(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    //最多x条跑马灯
    private int marqueeLimit;

    //鉴定和赋能的抽奖道具id
    private int itemId;

    //鉴定消耗的道具数量
    private int consumeNum;

    //保底出6的需求抽数
    private int guaranteeNum;

    //第x次小保底是大保底
    private int bigGuaranteeTimes;

    //鉴定必给的基础奖励
    private String getReward;

    //大于等于配置星级即可跑马灯
    private int marqueeStar;

    //小宝底奖池
    private List<Integer> smallPoolItemList;
    private List<Integer> smallPoolWeightList;

    //大保底奖池
    private List<Integer> bigPoolItemList;
    private List<Integer> bigPoolWeightList;

    //六星魂骨抽奖部位保底（4;6代表当前获得六星魂骨数量达到6个时，若总获取的部位低于4种，则下次的六星一定为新部位，当玩家一轮的6种部位都获得后重置）
    private List<Integer> guarantee6List;

    //七星魂骨抽奖部位保底（4;6代表当前获得七星魂骨数量达到6个时，若总获取的部位低于4种，则下次的七星一定为新部位，当玩家一轮的6种部位都获得后重置）
    private List<Integer> guarantee7List;

    private List<SoulBoneLotteryInfo> lotteryInfoList;

    public List<SoulBoneLotteryInfo> getLotteryInfoList() {
        return lotteryInfoList;
    }

    public SoulBoneLotteryInfo getSoulBoneLotteryInfo(int id){
        for (SoulBoneLotteryInfo info : lotteryInfoList) {
            if(info.getId() == id){
                return info;
            }
        }
        return null;
    }

    public void setLotteryInfoList(List<SoulBoneLotteryInfo> lotteryInfoList) {
        this.lotteryInfoList = lotteryInfoList;
    }

    public int getMarqueeLimit() {
        return marqueeLimit;
    }

    public void setMarqueeLimit(int marqueeLimit) {
        this.marqueeLimit = marqueeLimit;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public int getConsumeNum() {
        return consumeNum;
    }

    public void setConsumeNum(int consumeNum) {
        this.consumeNum = consumeNum;
    }

    public int getGuaranteeNum() {
        return guaranteeNum;
    }

    public void setGuaranteeNum(int guaranteeNum) {
        this.guaranteeNum = guaranteeNum;
    }

    public int getBigGuaranteeTimes() {
        return bigGuaranteeTimes;
    }

    public void setBigGuaranteeTimes(int bigGuaranteeTimes) {
        this.bigGuaranteeTimes = bigGuaranteeTimes;
    }

    public String getGetReward() {
        return getReward;
    }

    public void setGetReward(String getReward) {
        this.getReward = getReward;
    }

    public int getMarqueeStar() {
        return marqueeStar;
    }

    public void setMarqueeStar(int marqueeStar) {
        this.marqueeStar = marqueeStar;
    }

    public List<Integer> getGuarantee6List() {
        return guarantee6List;
    }

    public void setGuarantee6List(List<Integer> guarantee6List) {
        this.guarantee6List = guarantee6List;
    }

    public List<Integer> getGuarantee7List() {
        return guarantee7List;
    }

    public void setGuarantee7List(List<Integer> guarantee7List) {
        this.guarantee7List = guarantee7List;
    }

    public List<Integer> getSmallPoolItemList() {
        return smallPoolItemList;
    }

    public void setSmallPoolItemList(List<Integer> smallPoolItemList) {
        this.smallPoolItemList = smallPoolItemList;
    }

    public List<Integer> getSmallPoolWeightList() {
        return smallPoolWeightList;
    }

    public void setSmallPoolWeightList(List<Integer> smallPoolWeightList) {
        this.smallPoolWeightList = smallPoolWeightList;
    }

    public List<Integer> getBigPoolItemList() {
        return bigPoolItemList;
    }

    public void setBigPoolItemList(List<Integer> bigPoolItemList) {
        this.bigPoolItemList = bigPoolItemList;
    }

    public List<Integer> getBigPoolWeightList() {
        return bigPoolWeightList;
    }

    public void setBigPoolWeightList(List<Integer> bigPoolWeightList) {
        this.bigPoolWeightList = bigPoolWeightList;
    }

    public void parseGuaranteeParam(String soul_bone_roll_guarantee_param) {
        List<Integer> itemList = new ArrayList<>();
        List<Integer> weightList = new ArrayList<>();
        List<String> stringList = StringUtils.stringToStringList(soul_bone_roll_guarantee_param, "\\|");
        for (String s : stringList) {
            List<Integer> list = StringUtils.stringToIntegerList(s, ",");
            if(list.size() == 2){
                itemList.add(list.get(0));
                weightList.add(list.get(1));
            }
        }
        smallPoolItemList = itemList;
        smallPoolWeightList = weightList;
    }

    public void parseBigGuaranteeParam(String soul_bone_roll_big_guarantee_param) {
        List<Integer> itemList = new ArrayList<>();
        List<Integer> weightList = new ArrayList<>();
        List<String> stringList = StringUtils.stringToStringList(soul_bone_roll_big_guarantee_param, "\\|");
        for (String s : stringList) {
            List<Integer> list = StringUtils.stringToIntegerList(s, ",");
            if(list.size() == 2){
                itemList.add(list.get(0));
                weightList.add(list.get(1));
            }
        }
        bigPoolItemList = itemList;
        bigPoolWeightList = weightList;
    }

    public void parseGuarantee6(String soul_bone_roll_type_guarantee_6) {
        List<Integer> allList = new ArrayList<>();
        List<String> stringList = StringUtils.stringToStringList(soul_bone_roll_type_guarantee_6, "\\|");
        for (String s : stringList) {
            List<Integer> list = StringUtils.stringToIntegerList(s, ";");
            allList.addAll(list);
        }
        guarantee6List = allList;
    }

    public void parseGuarantee7(String soul_bone_roll_type_guarantee_7) {
        List<Integer> allList = new ArrayList<>();
        List<String> stringList = StringUtils.stringToStringList(soul_bone_roll_type_guarantee_7, "\\|");
        for (String s : stringList) {
            List<Integer> list = StringUtils.stringToIntegerList(s, ";");
            allList.addAll(list);
        }
        guarantee7List = allList;
    }
}
